#include <bits/stdc++.h>
const double PI = 3.14159265358979323846;
using namespace std;
using ll = long long;
using P = pair<int, int>;
int cmpnum(const void *a, const void *b) {
  long long *A = (long long *)a;
  long long *B = (long long *)b;
  if (*A > *B) return 1;
  if (*A < *B) return -1;
  return 0;
}
int char_sort_max(const void *a, const void *b) {
  return strcmp((char *)a, (char *)b);
}
int char_sort_min(const void *a, const void *b) {
  return strcmp((char *)a, (char *)b);
}
int gcd(int x, int y) {
  int t;
  while (y != 0) {
    t = x % y;
    x = y;
    y = t;
  }
  return x;
}
ll lcm(ll a, ll b) { return (ll)((ll)(a * b) / (ll)(gcd(a, b))); }
bool IsPrime(int num) {
  if (num < 2)
    return false;
  else if (num == 2)
    return true;
  else if (num % 2 == 0)
    return false;
  double sqrtNum = sqrt(num);
  for (int i = 3; i <= sqrtNum; i += 2) {
    if (num % i == 0) {
      return false;
    }
  }
  return true;
}
struct UnionFind {
  vector<int> d;
  UnionFind(int n = 0) : d(n, -1){};
  int find(int x) {
    if (d[x] < 0) {
      return x;
    } else {
      return d[x] = find(d[x]);
    }
  }
  bool unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x, y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return -d[find(x)]; }
};
struct mint {
  ll x;
  mint(ll x) : x((x % 1000000007 + 1000000007) % 1000000007) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a) {
    if ((x += a.x) >= 1000000007) x -= 1000000007;
    return *this;
  }
  mint &operator-=(const mint a) {
    if ((x += 1000000007 - a.x) >= 1000000007) x -= 1000000007;
    return *this;
  }
  mint &operator*=(const mint a) {
    if ((x *= a.x) %= 1000000007)
      ;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(1000000007 - 2); }
  mint &operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};
mint kaijyo(int n) {
  if (n == 0) return 1;
  mint x = kaijyo(n / 2);
  x *= x;
  if (n % 2 == 1) x *= 2;
  return x;
}
mint choose(int n, int a) {
  mint x = 1, y = 1;
  for (int i = 0; i < (a); ++i) {
    x *= n - i;
    y *= i + 1;
  }
  return x / y;
}
int shakutori(ll x, ll n, ll k, ll a[]) {
  long long int ai, res, ok, ng, mid;
  res = 0;
  for (int i = 0; i < n; i++) {
    ai = a[i];
    if (ai == 0) {
      if (x < 0) {
        res += 0;
      } else {
        res += n - 1;
      }
    } else {
      if (ai <= -1) {
        if (ai * ai <= x) {
          res -= 1;
        }
        ok = n;
        ng = -1;
        while (ok - ng > 1) {
          mid = (ok + ng) / 2;
          if (a[mid] * ai <= x) {
            ok = mid;
          } else {
            ng = mid;
          }
        }
        res += n - ok;
      } else {
        if (ai * ai <= x) {
          res -= 1;
        }
        ok = -1;
        ng = n;
        while (ng - ok > 1) {
          mid = (ok + ng) / 2;
          if (a[mid] * ai <= x) {
            ok = mid;
          } else {
            ng = mid;
          }
        }
        res += ok + 1;
      }
    }
  }
  return k <= res / 2;
}
int two_n(int tei, int jyousuu) {
  if (jyousuu == 0) return 1;
  int x = two_n(tei, jyousuu / 2);
  x *= x;
  if (jyousuu % 2 == 1) {
    x *= tei;
  }
  return x;
}
vector<vector<int>> bit_search(int N) {
  vector<vector<int>> bit_sum(two_n(2, N));
  int num = 0;
  for (int bit = 0; bit < (1 << N); ++bit) {
    for (int i = 0; i < N; ++i) {
      if (bit & (1 << i)) {
        bit_sum[num].push_back((i));
      }
    }
    num++;
  }
  return bit_sum;
}
vector<vector<int>> bit_search_array(int N) {
  vector<vector<int>> bit_sum(two_n(2, N), vector<int>(N, 0));
  int num = 0;
  for (int bit = 0; bit < (1 << N); ++bit) {
    for (int i = 0; i < N; ++i) {
      if (bit & (1 << i)) {
        bit_sum[bit][i] = 1;
      }
    }
    num++;
  }
  return bit_sum;
}
struct jyanken {
  int tensuu;
  char te;
  char aite;
};
int cmp_tensu(const void *n1, const void *n2) {
  if (((jyanken *)n1)->tensuu < ((jyanken *)n2)->tensuu) {
    return 1;
  } else if (((jyanken *)n1)->tensuu > ((jyanken *)n2)->tensuu) {
    return -1;
  } else {
    return 0;
  }
}
int main() {
  mint ans = 0;
  ll N;
  cin >> N;
  long long A[N];
  vector<ll> zero(60, 0);
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j <= 60; ++j) {
      if ((A[i] >> j & 1) == 0) {
        zero[j] += 1;
      }
    }
  }
  mint bit = 1;
  for (int i = 0; i <= 60; ++i) {
    ans += bit.x * zero[i] * (N - zero[i]);
    bit.x *= 2;
  }
  printf("%lld", ans.x);
}
int A() {
  int A, B, C;
  scanf("%d %d %d", &A, &B, &C);
  if (A + B + C <= 21) {
    printf("win");
  } else {
    printf("bust");
  }
  return 0;
}
int B() {
  char S[100];
  cin >> S;
  int A = strlen(S);
  int ans = 0;
  if (A % 2 == 1) {
    for (int i = 0; i < A / 2; ++i) {
      if (S[i] != S[A - i - 1]) {
        ans++;
      }
    }
  } else {
    for (int i = 0; i < A / 2; ++i) {
      if (S[i] != S[A - i - 1]) {
        ans++;
      }
    }
  }
  printf("%d", ans);
}
int C() {
  int N;
  cin >> N;
  vector<vector<int>> bit = bit_search_array(N);
  vector<vector<int>> A(N);
  vector<vector<int>> B(N);
  for (int i = 0; i < N; ++i) {
    int num;
    cin >> num;
    for (int j = 0; j < num; ++j) {
      int a, b;
      cin >> a >> b;
      A[i].push_back(a);
      B[i].push_back(b);
    }
  }
  int ans = 0;
  for (int i = 0; i < bit.size(); ++i) {
    int temp = 0;
    int count = 0;
    for (int j = 0; j < N; ++j) {
      if (bit[i][j] == 1) {
        count++;
        for (int s = 0; s < A[j].size(); ++s) {
          if (B[j][s] != bit[i][A[j][s] - 1]) {
            temp = -1;
          }
        }
      }
    }
    if (ans <= count && temp == 0) {
      ans = count;
    }
  }
  printf("%d", ans);
  return 0;
}
