fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define gc getchar_unlocked
  4. #define fo(i,n) for(i=0;i<n;i++)
  5. #define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
  6. #define ll long long
  7. #define si(x) scanf("%d",&x)
  8. #define sl(x) scanf("%lld",&x)
  9. #define ss(s) scanf("%s",s)
  10. #define pi(x) printf("%d\n",x)
  11. #define pl(x) printf("%lld\n",x)
  12. #define ps(s) printf("%s\n",s)
  13. #define pb push_back
  14. #define mp make_pair
  15. #define F first
  16. #define S second
  17. #define all(x) x.begin(), x.end()
  18. #define clr(x) memset(x, 0, sizeof(x))
  19. #define sortall(x) sort(all(x))
  20. #define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
  21. #define PI 3.1415926535897932384626
  22. typedef pair<int, int> pii;
  23. typedef pair<ll, ll> pll;
  24. typedef vector<int> vi;
  25. typedef vector<ll> vll;
  26. typedef vector<pii> vpii;
  27. typedef vector<pll> vpll;
  28. typedef vector<vi> vvi;
  29. typedef vector<vll> vvl;
  30. const int mod = 1000000007;
  31. const int N = 3e5;
  32. vi g[N];
  33. int a[N];
  34. int mpow(int base, int exp);
  35. void ipgraph(int n, int m);
  36. void dfs(int u, int par);
  37. int LIM = 1000004;
  38. int dp[1000004];
  39. int main()
  40. {
  41. ios_base::sync_with_stdio(false);
  42. cin.tie(NULL);
  43. int i,n,k,j;
  44. cin>>n;
  45. int allone = 1<<21;
  46. allone--;
  47. fo(i, LIM) dp[i] = allone;
  48. fo(i, n) cin>>k, dp[k] = k;
  49. int cnt = 0;
  50. Fo(i, LIM-1, 0){
  51. cnt += dp[i] == i;
  52. fo(j, 21){
  53. if(((1<<j)&i)) dp[i^(1<<j)] &= dp[i];
  54. }
  55. }
  56. cout<<cnt+1<<endl;
  57. return 0;
  58. }
  59.  
  60.  
Success #stdin #stdout 0.06s 27344KB
stdin
4
1 3 6 7
stdout
6